package mapper

import (
	"GinShop/config"
	"GinShop/model"
)

type FoodCategoryMapper struct {
	*config.Orm
}

//实例化Dao对象
func NewFoodCategoryMapper() *FoodCategoryMapper {
	return &FoodCategoryMapper{config.DB}
}

//从数据库中查询所有的食品种类，并返回
func (fcd *FoodCategoryMapper) QueryCategories() []model.FoodCategory {
	var categories []model.FoodCategory
	fcd.Find(&categories)

	return categories
}
